﻿using System;
using System.Collections.Generic;

namespace MvcForum.Net.Bussiness
{
    public class Forum
    {

        public int ForumId { get; set; }


        public string Icon { get; set; }

        public string ForumName { get; set; }

        public int ParentId { get; set; }

        public string Keywords { get; set; }

        public string Description { get; set; }

        public short SortOrder { get; set; }

        public string RemoteUrl { get; set; }

        public bool IsLocked { get; set; }

        public bool AllowPostWithIn { get; set; }

        public short ModerateType { get; set; }

        public string AllowRoles { get; set; }

        public bool VisibleAtHomePage { get; set; }

        public long TotalTopics { get; set; }

        public long TotalReplies { get; set; }

        public short OrderBy { get; set; }

        public short SortDirection { get; set; }

        public bool IncreaseMemberPosts { get; set; }

        public int? LastPostId { get; set; }

        public string LastPostTitle { get; set; }

        public DateTime LastPostDate { get; set; }

        public string LastUserPost { get; set; }

        public int TopicsPerPage { get; set; }

        public int PostsPerPage { get; set; }

        public bool AllowSearch { get; set; }

        public int Level { get; set; }

        public string LevelName { get; set; }

        public IEnumerable<string> Roles
        {
            get
            {
                if(!string.IsNullOrWhiteSpace(AllowRoles))
                {
                  var _roles=  AllowRoles.Split(new char[] {',', ';'}, StringSplitOptions.RemoveEmptyEntries);
                    return _roles;
                }
                return null;
            }

        }




    }
}
